package com.memo;

import java.util.Date;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.memo.controller.MainListAdapter;
import com.memo.model.ListItemMainMenu;

public class MainMenuActivity extends ListActivity{
	
	private final ListItemMainMenu[] listItems = {
	        new ListItemMainMenu(R.drawable.calendar_main, R.string.gifts_list, true),
	        new ListItemMainMenu(R.drawable.gift_main, R.string.add_gift, true),
	        new ListItemMainMenu(R.drawable.clock_main, R.string.emergency_gift, true),
	        new ListItemMainMenu(R.drawable.settings_main, R.string.settings, true)};

	    @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);	      
	        setContentView(R.layout.main_menu);
	        setListAdapter(new MainListAdapter(this, listItems));
	    }

	    @Override
	    protected void onListItemClick(ListView l, View v, int position, long id) {
	        super.onListItemClick(l, v, position, id);

	        switch (position) {
	            case 0: {	//Gifts List (calendar)
	            	Date dp = new Date();
	            	Intent intent = new Intent();
	            	intent.setClass(this, CalendarView.class);
		    		intent.putExtra("date", dp.getYear()+"-"+dp.getMonth()+"-"+dp.getDay());
		    		startActivity(intent);
	                break;
	            }
	            case 1: {	//Add Gift
	                Intent intent = new Intent();
	                intent.setClass(this, AddGiftActivity.class);
	                startActivity(intent);
	            	break;
	            }
	            case 2: {	//Emargency Gift
	            	
	            	break;
	            }
	            case 3: {	//Settings
	            	
	            	break;
	            }
	            default: {
	                return;
	            }
	        }
	    }
}
